<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" 
      xmlns:a="http://remanso.biz/apollo/tag">  

    <ui:composition template="layout.xhtml">
        <ui:define name="corpo">
             <h:form>
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}"
                                    value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  value="Imóvel" update="@form" immediate="true"/>
                </div>
            </h:form>
            <p:panel header="Principal - Imóvel">
                <table style="min-height:500px; width: 100%">
                    <tr>
                        <td style="width: 200px; vertical-align:top;">
                            <ui:include src="menuImovel.xhtml"/>
                        </td>
                        <td style="vertical-align:top;">
                            <h:form id="index_form" acceptcharset="utf-8"> 

                                <p:messages autoUpdate="true" showDetail="true"/>
                                <h:panelGrid rendered="false" style="float: right;" columns="6">
                                    <p:graphicImage url="/media/img/new.png" title="Cadastrar Imóvel" /> 
                                    <p:commandLink value="Cadastrar" style="margin-left: -5px;"
                                                   title="Cadastrar Imóvel" action="#{managerImovel.criarImovel()}" />
                                    <p:graphicImage url="/media/img/search.png" title="Pesquisar Imóvel"/>
                                    <p:commandLink value="Pesquisar" style="margin-left: -5px;"
                                                   title="Pesquisar Imóvel" action="#{managerImovel.pesquisarImovel()}" />
                                    <p:graphicImage url="/media/img/search.png" title="Pesquisar Imóvel"/>
                                    <p:commandLink value="Conflito" style="margin-left: -5px;" 
                                                   title="Consultar Conflito"
                                                   action="#{managerIndex.redirect('compCoord.xhtml')}" />
                                </h:panelGrid>
                                <h:panelGrid rendered="false" style="float: left;" columns="4">
                                    <p:graphicImage url="/media/img/certidoes.png" title="Certidões" /><p:commandLink value="Certidões" id="linkCertidoes" style="margin-left: -7px;"  title="Certidões Positiva ou Negativa" />
                                    <p:overlayPanel id="certidoes" for="linkCertidoes" hideEffect="fade">  
                                        <h:panelGrid columns="2">
                                            <p:graphicImage url="/media/img/certidaoPositiva.png" title="Positiva" />
                                            <p:commandLink value="Positiva" style="margin-left: -7px;"  title="Certidões Positiva" 
                                                           action="#{managerImovel.redirect('certidaoPositiva.xhtml')}" />

                                            <p:graphicImage url="/media/img/certidaoNegativa.png" title="Negativa" />
                                            <p:commandLink value="Negativa" style="margin-left: -7px;"  title="Certidões Negativa"
                                                           action="#{managerImovel.redirect('certidaoNegativa.xhtml')}" />

                                        </h:panelGrid>
                                    </p:overlayPanel>  


                                </h:panelGrid>
                                <p:dataTable id="imovelTable" var="imovels" 
                                             value="#{managerImovel.listarImoveis()}"
                                             paginator="true" rows="5"
                                             paginatorPosition="bottom"
                                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} "  
                                             rowsPerPageTemplate="5,10,15"
                                             emptyMessage="Nenhum Registro Cadastro"
                                             rowKey="#{imovels.id}"
                                             >  
                                    <f:facet name="header">  
                                        Ultimos Imovéis Cadastrados
                                    </f:facet>
                                    <p:column style="width:90px;">  
                                        <f:facet name="header" >   
                                            Registro   
                                        </f:facet>  
                                        <h:outputText value="#{imovels.registro}" />  
                                    </p:column>
                                    <p:column>  
                                        <f:facet name="header" >   
                                            Objeto 
                                        </f:facet>  
                                        <h:outputText value="#{imovels.objeto.tipo}" escape="false" />  
                                    </p:column>
                                    <p:column>  
                                        <f:facet name="header" >   
                                            Endereço 
                                        </f:facet>  
                                        <h:outputText value="Um(a) #{imovels.objeto.tipo} localizada(o) na #{imovels.objeto.tipo_logradouro} 
                                                      #{imovels.objeto.logradouro}, #{imovels.objeto.numero}, bairro #{imovels.objeto.bairro}; com as
                                                      seguintes confrontações: frente, #{imovels.objeto.frente}, lado direito, #{imovels.objeto.ladoDireito}, lado esquerdo,
                                                      #{imovels.objeto.ladoEsquerdo}
                                                      " escape="true" />  
                                    </p:column>
                                    <p:column style="width:120px;" headerText="Opções">  

                                        <p:commandButton style="float:left;" title="Transferir Imóvel" icon="transferir" actionListener="#{managerTransfencia.transferirImovel(imovels)}" update="@form"/>
                                        <p:commandButton style="float:left;" title="Averbar Imóvel" icon="averbar" actionListener="#{managerAverbacao.averbarImovel(imovels)}" update="@form"/>
                                        <p:commandButton style="float:left;" title="Registrar Imóvel" icon="registro" actionListener="#{managerRegistro.registrarImovel(imovels)}" update="@form"/>
                                        <p:commandButton style="float:left;" title="Visualizar Imóvel" icon="view" actionListener="#{managerBuscarImovel.verImovel(imovels)}" update="@form"/>

                                    </p:column>    
                                </p:dataTable>
                                <p:blockUI block="imovelTable" trigger="imovelTable">  
                                    CARREGANDO...<br />  
                                    <p:graphicImage value="/media/img/ajax-loader.gif"/>  
                                </p:blockUI>


                            </h:form>
                        </td></tr></table>
            </p:panel>
        </ui:define>
    </ui:composition>
</html>